// 本地存储工具函数
export const getToken = () => {
  return localStorage.getItem('token') || sessionStorage.getItem('token')
}

export const setToken = (token, remember = false) => {
  if (remember) {
    localStorage.setItem('token', token)
  } else {
    sessionStorage.setItem('token', token)
  }
}

export const removeToken = () => {
  localStorage.removeItem('token')
  sessionStorage.removeItem('token')
}

export const getItem = (key) => {
  return localStorage.getItem(key) || sessionStorage.getItem(key)
}

export const setItem = (key, value, remember = false) => {
  if (remember) {
    localStorage.setItem(key, value)
  } else {
    sessionStorage.setItem(key, value)
  }
}

export const removeItem = (key) => {
  localStorage.removeItem(key)
  sessionStorage.removeItem(key)
}